<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
    .box{
      width: 200px;
      height: 200px;
      background-color: rgb(170, 38, 38);
      margin: 20px auto;
    }
    .box2{
      width: 200px;
      height: 200px;
      background-color: rgb(66, 16, 200);
      margin: 20px auto;
    }
  </style>
</head>
<body>
  <div id="app">
      <button @click="toggleBox">显示弹窗</button>
      <div v-if="isShow" class="box">box1</div>
      <div v-else class="box2">box2</div>
  </div>
  <script src="./vue.js"></script>
  <script>
    const vm = new Vue({
      data: {
        isShow: true
      },
      methods: {
        toggleBox(){
          this.isShow = !this.isShow;
        }
      }
    })
    vm.$mount('#app');
  </script>
</body>
</html>